﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
using Volo.Abp;
using System.ComponentModel.DataAnnotations;
using Bridge.Shared.Enums.Wms;

namespace Bridge.Wms.Domain
{
    [Comment("订单主表")]
    [Table("t_voucher_order")]
    [Index(nameof(VoucherCode))]
    public class Order : AuditedAggregateRoot<Guid>, ISoftDelete, IMultiTenant
    {
        public Order() { }
        public Order(Guid id)
        {
            this.Id = id;
        }
        /// <summary>
        /// 单据编号
        /// </summary>
        [MaxLength(32)]
        [Comment("单据编号")]
        public string VoucherCode { get; set; }


        /// <summary>
        /// 发货仓库
        /// </summary>
        [MaxLength(36)]
        [Comment("发货仓库")]
        public Guid WarehouseId { get; set; }

        /// <summary>
        /// 发货仓库
        /// </summary>
        [MaxLength(50)]
        [Comment("仓库名称")]
        public string WarehouseName { get; set; }

        /// <summary>
        /// 供应商编码
        /// </summary>
        [MaxLength(36)]
        [Comment("供应商编码")]
        public Guid? SupplierId { get; set; }

        /// <summary>
        /// 供应商名称
        /// </summary>
        [MaxLength(20)]
        [Comment("供应商名称")]
        public string SupplierName { get; set; }

        /// <summary>
        /// 申请时间
        /// </summary>
        [Comment("申请时间")]
        public DateTime CreatedOn { get; set; }

        /// <summary>
        /// 申请人
        /// </summary>
        [MaxLength(20)]
        [Comment("申请人")]
        public string CreatedBy { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        [Comment("审核时间")]
        public DateTime? AuditOn { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        [MaxLength(20)]
        [Comment("审核人")]
        public string AuditBy { get; set; }

        /// <summary>
        /// 订单状态：0 暂存 1已作废 2已提交 3已驳回 5已审核
        /// </summary>
        [Comment("订单状态")]
        public OrderStatusEnum Status { get; set; }

        /// <summary>
        /// 删除标识
        /// </summary>
        [Comment("删除标识")]
        public bool IsDeleted { get; set; } = false;


        public Guid? TenantId { get; set; }
    }
}
